From 0a28c5336a9e1822c7f045427f86b31d98d5ed29 Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Mon, 27 Feb 2006 10:34:03 +0000 Subject: [PATCH] Fix non-xen build for: Make the fixmap area moveable in kernel address space. From: Gerd Hoffmann Signed-off-by: Christian Limpach --- linux-2.6-xen-sparse/arch/i386/mm/pgtable.c | 12 ++++++++++++ linux-2.6-xen-sparse/include/asm-i386/fixmap.h | 4 +++- linux-2.6-xen-sparse/include/asm-i386/page.h | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/i386/mm/pgtable.c b/linux-2.6-xen-sparse/arch/i386/mm/pgtable.c index 9db3242103..8b2e540349 100644 --- a/linux-2.6-xen-sparse/arch/i386/mm/pgtable.c +++ b/linux-2.6-xen-sparse/arch/i386/mm/pgtable.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -138,6 +139,10 @@ void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags) __flush_tlb_one(vaddr); } +static int nr_fixmaps = 0; +unsigned long __FIXADDR_TOP = 0xfffff000; +EXPORT_SYMBOL(__FIXADDR_TOP); + void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags) { unsigned long address = __fix_to_virt(idx); @@ -147,6 +152,13 @@ void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags) return; } set_pte_pfn(address, phys >> PAGE_SHIFT, flags); + nr_fixmaps++; +} + +void set_fixaddr_top(unsigned long top) +{ + BUG_ON(nr_fixmaps > 0); + __FIXADDR_TOP = top - PAGE_SIZE; } pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) diff --git a/linux-2.6-xen-sparse/include/asm-i386/fixmap.h b/linux-2.6-xen-sparse/include/asm-i386/fixmap.h index a2c73a7f2d..d4774a0b64 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/fixmap.h +++ b/linux-2.6-xen-sparse/include/asm-i386/fixmap.h @@ -20,7 +20,7 @@ * Leave one empty page between vmalloc'ed areas and * the start of the fixmap. */ -#define __FIXADDR_TOP 0xfffff000 +extern unsigned long __FIXADDR_TOP; #ifndef __ASSEMBLY__ #include @@ -94,6 +94,8 @@ enum fixed_addresses { extern void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags); +extern void set_fixaddr_top(unsigned long top); + #define set_fixmap(idx, phys) \ __set_fixmap(idx, phys, PAGE_KERNEL) /* diff --git a/linux-2.6-xen-sparse/include/asm-i386/page.h b/linux-2.6-xen-sparse/include/asm-i386/page.h index db44078217..462b602216 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/page.h +++ b/linux-2.6-xen-sparse/include/asm-i386/page.h @@ -121,7 +121,7 @@ extern int page_is_ram(unsigned long pagenr); #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) -#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE) +#define MAXMEM (__FIXADDR_TOP-__PAGE_OFFSET-__VMALLOC_RESERVE) #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) -- 2.30.2